package com.hong;

import com.alibaba.dubbo.config.ApplicationConfig;
import com.alibaba.dubbo.config.RegistryConfig;
import com.alibaba.dubbo.config.ServiceConfig;
import com.hong.dubbo.api.HelloDubboService;
import com.hong.impl.HelloDubboServiceImpl;

/**
 * @author Macrowang
 * @date 2019/03/01 9:57
 **/
public class ProviderMain {
    public static void main(String[] args) throws Exception {
        /**
         * 不使用xml配置文件，直接已Java代码配置注册暴露服务
         */
        ServiceConfig<HelloDubboServiceImpl> service = new ServiceConfig<>();
        service.setApplication(new ApplicationConfig("dubbo-provider2"));
        service.setRegistry(new RegistryConfig("zookeeper://127.0.0.1:2181"));
        service.setInterface(HelloDubboService.class);
        service.setRef(new HelloDubboServiceImpl());
        service.export();
        System.in.read();
    }
}